define(['jquery',"storage","networking","jweixin"],function($){
	var shareInfo = {
	    _linkUrl        : 'http://scale.yoparent.cn/chuangyezhe/index.html',
	    _imgUrl         : 'http://static.xingfuchuangke.cn/scale/common/1411423470.png', //分享图片地址
	    _descTitle      : '创业者成功率分析测评',                             	//分享标题
	    _descContent    : '创业者成功率分析测评是由幸福创客专业科学测评中心，依据学者熊彼特的创新理论与剑桥创业者核心能力模型编制而成。企业家精神源于自我实现的心理动机，是一名优秀的创业者成功的基础和必备条件。同时，创业者的成功也需要很多特定能力的支撑。测评结果全面分析答题者的多维度企业家素质与核心能力，亦计算出创业的成功率。',     //分享语
	}
	var getWXInfo = function(){	
		$.ajax({
	      	url: HTTPRouter.getWXInfoUrl,
	      	type: 'GET',
	      	data:{
	      		url:encodeURI(window.location.href),
	      	},
	      	dataType: 'json',
	      	error: function (e) {
	        	console.log("请求异常！");
	      	},
	      	success: function (paperDate) {
		        paperDate  = JSON.parse(paperDate);
		        AppStorage.setValueInSession("token",paperDate.token);
		        initWXConfig(paperDate);
	      	}
	    });
	    
	}();
	
	function initWXConfig(date){
	    wx.config({
	      debug: false,
	      appId: date.singatureParm.appId,
	      timestamp: date.singatureParm.timestamp,
	      nonceStr: date.singatureParm.nonceStr,
	      signature: date.singatureParm.signature,
	      startTime: date.startTime,
	      jsApiList: [
	        'onMenuShareTimeline',
	        'onMenuShareAppMessage'
	      ]
	    });
	   wxReady();
	}
	
	function wxReady(){
	    wx.ready(function () {
		  	wx.onMenuShareTimeline({
			    title: shareInfo._descTitle,
			    link: shareInfo._linkUrl,
			    imgUrl: shareInfo._imgUrl,
			    success: function () {},
			    cancel: function () {},
			    fail:function (res) {
			      // alert("分享失败：" +JSON.stringify(res));
			    }
		  	});
			wx.onMenuShareAppMessage({
			    title: shareInfo._descTitle,
			    desc: shareInfo._descContent,
			    link: shareInfo._linkUrl,
			    imgUrl: shareInfo._imgUrl,
			    type: 'link',
				dataUrl: '',
				success: function () {},
				cancel: function () {},
				fail:function (res) {
				  // alert("分享失败：" +JSON.stringify(res));
				}
			});
	    });
	}

});
